package src.Server;
import java. awt .*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax. swing .*;

import src.Server.YYChatServer;

public class StartServer extends JFrame implements ActionListener {
    JButton jb1, jb2;
    public StartServer () {
        jb1=new JButton("启动服务器");
        jb1.addActionListener(this);
        jb1.setFont(new Font("宋体",Font.BOLD,25));//设置字体
        jb2=new JButton("停止服务器");
        jb2.setFont (new Font("*4",Font.BOLD,25));

        this.setLayout(new GridLayout(1,2));//网格布局
        this.add(jb1) ;
        this.add(jb2);
        this.setSize(400,100);
        this. setLocationRelativeTo(null);
        this.setIconImage (new
                ImageIcon ("src/images/duck2.gif").getImage());
        this. setTitle ("YYchat") ;
        this.setVisible (true);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }

    public static void main (String[] args) {
        new StartServer() ;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == jb1){
            new YYChatServer();
        }
    }
}